package com.kakarote.hrm.constant;

/**
 * 招聘计划上报枚举
 *
 * @author system
 * @since 2024-01-01
 */
public enum RecruitPlanReportStatusEnum {

    NO_NEED(1, "无需上报"),

    SECONDARY_REPORT(2, "二次上报"),

    ADJUST_REPORT(3, "调整上报"),

    REPORT(4, "首次上报"),
    ;

    private final Integer status;
    private final String name;

    RecruitPlanReportStatusEnum(Integer status, String name) {
        this.status = status;
        this.name = name;
    }

    public Integer getStatus() {
        return status;
    }

    public String getName() {
        return name;
    }

    /**
     * 根据状态值获取状态名称
     *
     * @param status 状态值
     * @return 状态名称
     */
    public static String getNameByStatus(Integer status) {
        if (status == null) {
            return "";
        }
        for (RecruitPlanReportStatusEnum statusEnum : values()) {
            if (statusEnum.getStatus().equals(status)) {
                return statusEnum.getName();
            }
        }
        return "未知状态";
    }

    /**
     * 根据状态值获取枚举
     *
     * @param status 状态值
     * @return 枚举
     */
    public static RecruitPlanReportStatusEnum getByStatus(Integer status) {
        if (status == null) {
            return null;
        }
        for (RecruitPlanReportStatusEnum statusEnum : values()) {
            if (statusEnum.getStatus().equals(status)) {
                return statusEnum;
            }
        }
        return null;
    }
}
